package com.evola.dbsm.model
{
	import mx.formatters.DateFormatter;

	[Bindable]
	public class BaseBean
	{

		private var _id:int;
		private var _createdBy:UserBean;
		private var _creationDate:Date;

		public function BaseBean()
		{
		}

		public function get isPeristed():Boolean
		{

			return id > 0;
		}

		public function get createdBy():UserBean
		{
			return _createdBy;
		}

		public function set createdBy(value:UserBean):void
		{
			_createdBy=value;
		}

		public function get id():int
		{
			return _id;
		}

		public function set id(value:int):void
		{
			_id=value;
		}

		public function get creationDate():Date
		{
			return _creationDate;
		}

		public function set creationDate(value:Date):void
		{
			_creationDate=value;
		}

		public function getCreationDateString():String
		{

			var string:String;

			if (_creationDate)
			{
				var df:DateFormatter=new DateFormatter();
				df.formatString="MM.DD.YYYY";
				string=df.format(_creationDate);
			}
			else
			{
				string="";
			}

			return string;
		}


	}
}
